package com.huawei.appgallery.forum.option.post.view;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.TextUtils.TruncateAt;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import huawei.widget.HwTextView;
import o.bqy;
import o.byc.a;
import o.byc.c;
import o.byc.e;
import o.byc.j;
import o.cjz;
import o.dky.k;
import o.ContentManager;
import o.epv;

public class InsertImgToolbar extends LinearLayout {
    protected static final Drawable ˎ = bqy.ˋ().ˏ().getResources().getDrawable(c.ʼ);
    protected static final Drawable ॱ = bqy.ˋ().ˏ().getResources().getDrawable(c.ʻ);
    private TextView ˋ;

    public InsertImgToolbar(Context context) {
        super(context);
        ˊ(context, null);
    }

    public InsertImgToolbar(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        ˊ(context, attributeSet);
    }

    public InsertImgToolbar(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ˊ(context, attributeSet);
    }

    private void ˊ(Context context, AttributeSet attributeSet) {
        int dimensionPixelSize = getContext().getResources().getDimensionPixelSize(a.ॱ);
        setMinimumHeight(getContext().getResources().getDimensionPixelSize(a.ˏ));
        setPadding(dimensionPixelSize, 0, dimensionPixelSize, 0);
        View hwTextView = new HwTextView(context, attributeSet);
        hwTextView.setCompoundDrawablePadding(getContext().getResources().getDimensionPixelSize(a.ˋ));
        hwTextView.setEllipsize(TruncateAt.END);
        hwTextView.setTextAppearance(getContext(), k.ˎ);
        addView(hwTextView);
        setBackgroundResource(c.ˏ);
        Drawable drawable = ॱ;
        int dimensionPixelSize2 = hwTextView.getContext().getResources().getDimensionPixelSize(a.ˊ);
        drawable.setBounds(0, 0, dimensionPixelSize2, dimensionPixelSize2);
        hwTextView.setCompoundDrawables(null, drawable, null, null);
        hwTextView.setText(j.ʼ);
        this.ˋ = hwTextView;
        cjz.ˎ(hwTextView);
    }

    public void setDisable(boolean z) {
        if (this.ˋ != null) {
            int color;
            Drawable drawable;
            if (z) {
                color = getResources().getColor(e.ˏ);
                drawable = ॱ;
            } else {
                color = getResources().getColor(e.ˋ);
                drawable = ˎ;
            }
            int ˋ = epv.ˋ(ContentManager.getInstant().getContext(), 24);
            drawable.setBounds(0, 0, ˋ, ˋ);
            this.ˋ.setCompoundDrawables(null, drawable, null, null);
            this.ˋ.setEnabled(z);
            this.ˋ.setTextColor(color);
            setEnabled(z);
        }
    }
}
